<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js onload</title>

</head>
<body onload="checkCookies()">

    <script type="text/javascript">
        function checkCookies() {
            if (navigator.cookieEnabled === true) {
                alert("已启用 cookie");
            }
            else {
                alert("未启用 cookie");
            }
        }
    </script>
</body>
</html>